module.exports = (app) => {
  // 幻灯片
  app.get('/api/home/swiper', (req, res) => {
    res.send({
      code: 0,
      msg: 'ok',
      data: [
        {
          id: 1,
          imgurl: 'http://video.1314000.cn/s1.jpg',
          title: '干锅花菜'
        },
        {
          id: 2,
          imgurl: 'http://video.1314000.cn/s2.jpg',
          title: '春日限定——腌笃鲜'
        },
        {
          id: 3,
          imgurl: 'http://video.1314000.cn/s3.jpg',
          title: '酱香干锅手撕包菜 '
        }
      ]
    })
  })

  // 热门分类
  app.get('/api/home/hotcate', (req, res) => {
    res.send({
      code: 0,
      msg: 'ok',
      data: [
        {
          id: 1,
          title: '家常菜'
        },
        {
          id: 2,
          title: '汤'
        },
        {
          id: 3,
          title: '川菜'
        },
        {
          id: 4,
          title: '粤菜'
        },
        {
          id: 5,
          title: '早餐'
        },
        {
          id: 6,
          title: '火锅'
        },
        {
          id: 7,
          title: '素菜'
        },
        {
          id: 8,
          title: '粥'
        },
        {
          id: 9,
          title: '凉菜'
        },
        {
          id: 10,
          title: '烘焙'
        },
        {
          id: 11,
          title: '饮品'
        }
      ]
    })
  })

  // 精品好菜
  app.get('/api/home/goodfood', (req, res) => {
    const page = req.query.page ? Number(req.query.page) : 1
    const size = 10
    res.send({
      code: 0,
      msg: 'ok',
      data: {
        total: 100,
        list:
          page >= 3
            ? []
            : Array(size)
                .fill('')
                .map((_, index) => ({
                  id: page * size + index,
                  name: '花馒头-' + index,
                  img: 'http://video.1314000.cn/s2.jpg',
                  all_click: '961.2万',
                  favorites: '6.0万'
                }))
      }
    })
  })
}
